package com.cecsmsserve.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cecsmsserve.entity.HealthStatisticConfig;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface HealthStatisticConfigMapper extends BaseMapper<HealthStatisticConfig> {
    
    @Select("SELECT hsc.*, hrt.name as type_name, hrt.unit " +
            "FROM health_statistic_config hsc " +
            "LEFT JOIN health_record_type hrt ON hsc.type_id = hrt.id " +
            "WHERE hsc.user_id = #{userId} AND hsc.is_visible = 1 " +
            "ORDER BY hsc.display_order ASC")
    List<HealthStatisticConfig> getVisibleConfigsByUserId(@Param("userId") Integer userId);
    
} 